home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Unix / gopher+1.2b4 / object / GSgopherobj.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-15  |  5.0 KB  |  189 lines

  1. /********************************************************************
  2.  * lindner
  3.  * 3.3
  4.  * 1993/04/15 17:55:18
  5.  * /home/mudhoney/GopherSrc/CVS/gopher+/object/GSgopherobj.h,v
  6.  * Exp
  7.  *
  8.  * Paul Lindner, University of Minnesota CIS.
  9.  *
  10.  * Copyright 1991, 1992 by the Regents of the University of Minnesota
  11.  * see the file "Copyright" in the distribution for conditions of use.
  12.  *********************************************************************
  13.  * MODULE: GSgopherobj.h
  14.  * Header file, abstraction of a gopher type
  15.  *********************************************************************
  16.  * Revision History:
  17.  * GSgopherobj.h,v
  18.  * Revision 3.3  1993/04/15  17:55:18  lindner
  19.  * GSgetAdmin fix, plus more protos
  20.  *
  21.  * Revision 3.2  1993/03/24  17:09:42  lindner
  22.  * Additions for Localfile for each GopherObj
  23.  *
  24.  * Revision 3.1.1.1  1993/02/11  18:03:03  lindner
  25.  * Gopher+1.2beta release
  26.  *
  27.  * Revision 2.1  1993/02/09  22:47:54  lindner
  28.  * Added new def GSSfindBlock
  29.  *
  30.  * Revision 1.2  1993/01/31  00:31:12  lindner
  31.  * Gopher+ structures and macros.
  32.  *
  33.  * Revision 1.1  1992/12/10  23:27:52  lindner
  34.  * gopher 1.1 release
  35.  *
  36.  *
  37.  *********************************************************************/
  38.  
  39.  
  40. #ifndef GSGOPHEROBJ_H
  41. #define GSGOPHEROBJ_H
  42.  
  43. #include "boolean.h"
  44. #include "STRstring.h"
  45. #include "STAarray.h"
  46. #include "VIews.h"
  47.  
  48. #define A_FILE      '0'      /* Types of objects */
  49. #define A_DIRECTORY '1'
  50. #define A_CSO       '2'
  51. #define A_ERROR     '3'
  52. #define A_MACHEX    '4'
  53. #define A_PCBIN     '5'
  54. #define A_INDEX     '7'
  55. #define A_TELNET    '8'
  56. #define A_UNIXBIN   '9'
  57. #define A_SOUND     's'
  58. #define A_EVENT     'e'
  59. #define A_CALENDAR  'c'
  60. #define A_GIF       'g'
  61. #define A_HTML      'h'
  62. #define A_TN3270    'T'
  63. #define A_MIME      'M'
  64. #define A_IMAGE     'I'
  65. #define A_EOI        '.'
  66.  
  67. typedef struct g_struct GopherObj;
  68. #include "BLblock.h"
  69.  
  70. /*** Our gopher+ attributes structure ***/
  71.  
  72. struct gplus_struct
  73. {
  74.      /** Abstract Block **/
  75.      String *abstract;
  76.  
  77.      /** Admin Block **/
  78.      String *Admin;
  79.      String *ModDate;
  80.  
  81.      VIewArray *Views;
  82.  
  83.      /** Others Blocks**/
  84.      BlockArray *OtherBlocks;
  85. };
  86.  
  87. typedef struct gplus_struct GplusObj;      
  88.  
  89. /** Our Gopher Object Type **/
  90.  
  91. struct g_struct
  92. {
  93.      char    sFileType;     /* The type of object (A_FILE, A_CSO, etc)*/
  94.      String  *Title;        /* User displayable title */
  95.      String  *Selstr;       /* Selector string on host... */
  96.      String  *Host;         /* Internet name of host                  */
  97.      int     iPort;         /* Port number on host                    */
  98.      int     Itemnum;       /* The number of the item in the directory*/
  99.      int     weight;        /* The weight, expressed as a # from 0-1000 */
  100.  
  101.      String  *Localfile;    /* The local file of the item */
  102.  
  103.      boolean isgplus;       /* Item can be queried gopher+ style */
  104.      boolean isask;         /* Item contains an ASK block */
  105.      GplusObj *gplus;       /* Gopher + attributes */
  106. };
  107.  
  108.  
  109. typedef struct g_struct GopherStruct;
  110.  
  111. #define GSgetType(a) ((a)->sFileType)
  112. #define GSsetType(a,b) (a)->sFileType=(b)
  113.  
  114. #define GSgetTitle(a) ((STRget((a)->Title)))
  115. #define GSsetTitle(a,b) ((STRset((a)->Title, b)))
  116.  
  117. #define GSgetPath(a) ((STRget((a)->Selstr)))
  118. #define GSsetPath(a,b) ((STRset((a)->Selstr, b)))
  119.  
  120. #define GSgetHost(a) ((STRget((a)->Host)))
  121. #define GSsetHost(a,b) ((STRset((a)->Host, b)))
  122.  
  123. #define GSgetPort(a) ((a)->iPort)
  124. #define GSsetPort(a,b) (a)->iPort=(b)
  125.  
  126. #define GSgetNum(a) ((a)->Itemnum)
  127. #define GSsetNum(a,b) ((a)->Itemnum=(b))
  128.  
  129. #define GSgetWeight(a)   ((a)->weight)
  130. #define GSsetWeight(a,b) ((a)->weight=(b))
  131.  
  132. #define GSgetLocalFile(a) ((STRget((a)->Localfile)))
  133. #define GSsetLocalFile(a,b) ((STRset((a)->Localfile, (b))))
  134.  
  135. /****************** Gopher Plus attributes *******************/
  136. #define GSisGplus(a)    ((a)->isgplus)
  137. #define GSsetGplus(a,b) ((a)->isgplus=(b))
  138.  
  139. #define GSisAsk(a)      ((a)->isask)
  140. #define GSsetAsk(a,b)   ((a)->isask=(b))
  141.  
  142.  
  143. #define GSgplusInited(a) ((a)->gplus != NULL)
  144.  
  145. #define GSgetAbstract(a) (STRget((a)->gplus->abstract))
  146. #define GSgetAdmin(a)    (((a)->gplus == NULL) ? NULL : (STRget((a)->gplus->Admin)))
  147. #define GSgetModDate(a)  (STRget((a)->gplus->ModDate)) 
  148.  
  149. #define GSgetNumViews(a) (VIAgetTop((a)->gplus->Views))
  150. #define GSgetView(a,b)   (VIAgetEntry((a)->gplus->Views,(b)))
  151.  
  152. #define GSgetNumBlocks(a) (BLAgetTop((a)->gplus->OtherBlocks))
  153. #define GSgetBlock(a,b)   (BLAgetEntry((a)->gplus->OtherBlocks,(b)))
  154. #define GSfindBlock(a,b)  GSgetBlock(a,BLAsearch((a)->gplus->OtherBlocks,(b)))
  155.  
  156. /*** Real live functions defined in GSgopherobj.c ***/
  157.  
  158. GopherObj *GSnew();
  159. GopherObj *GSnewSet();
  160. void GSdestroy();
  161. void GSinit();
  162. void GSplusnew();
  163. void GStoNet();
  164. void GStoNetHTML();
  165. int  GSfromNet();
  166. int  GSfromLink();
  167. void GStoLink();
  168. void GScpy();
  169.  
  170. /****** Protocol transmission functions *******/
  171. int  GSconnect();
  172. void GStransmit();
  173. void GSsendHeader();
  174. void GSsendErrorHeader();
  175. int  GSrecvHeader();
  176. void GStransmit();
  177.  
  178. /******Gopher+ functions *******/
  179. void GSplusnew();
  180. void GSplusdestroy();
  181. void GSplusInit();
  182. void GSplustoNet();
  183. void GSpluscpy();
  184.  
  185. /***** Debugging functions *******/
  186. void GSplusPrint();
  187.  
  188. #endif /*GSGOPHEROBJ_H*/
  189.